﻿using System;
using System.Collections.Generic;
using System.Xml.Serialization;

namespace Evision.Zlsoft.Miaiap.Core.Model {
    [XmlRoot("details_xml")]
    public class InputPrescriptionApproval {
        [XmlElement("is_ITEM", IsNullable = true)]
        public string isITEM { get; set; } = "";

        [XmlElement("is_Uplode", IsNullable = true)]
        public string isUplode { get; set; } = "";

        [XmlElement("his_time", IsNullable = true)]
        public string uploadTime { get; set; } = "";

        [XmlElement("hosp_flag", IsNullable = true)]
        public string hospitalizationFlag { get; set; } = "";

        [XmlElement("treat_type", IsNullable = true)]
        public string treatmentType { get; set; } = "";

        [XmlElement("treat_code", IsNullable = true)]
        public string treatmentCode { get; set; } = "";

        [XmlElement("lis_adm_no", IsNullable = true)]
        public string lisAdmNo { get; set; } = "";

        [XmlElement("bed_no", IsNullable = true)]
        public string bedNumber { get; set; } = "";

        [XmlElement("area_code", IsNullable = true)]
        public string areaCode { get; set; } = "";

        [XmlElement("patient", IsNullable = true)]
        public HisPatient patientInfo { get; set; } = new HisPatient();

        [XmlArray("prescription_data", IsNullable = true)]
        [XmlArrayItem("prescription", IsNullable = true)]
        public List<Prescription> prescriptions { get; set; } = new List<Prescription>();
    }

    [XmlRoot("patient")]
    public class HisPatient {
        [XmlElement("name", IsNullable = true)]
        public string name { get; set; } = "";

        [XmlElement("is_infant", IsNullable = true)]
        public string isInfant { get; set; } = "";

        [XmlElement("birth", IsNullable = true)]
        public string birth { get; set; } = "";

        [XmlElement("sex", IsNullable = true)]
        public string sex { get; set; } = "";

        [XmlElement("weight", IsNullable = true)]
        public string weight { get; set; } = "";

        [XmlElement("height", IsNullable = true)]
        public string height { get; set; } = "";

        [XmlElement("medical_record", IsNullable = true)]
        public string medicalRecord { get; set; } = "";

        [XmlElement("card_type", IsNullable = true)]
        public string cardType { get; set; } = "";

        [XmlElement("card_code", IsNullable = true)]
        public string cardCode { get; set; } = "";

        [XmlElement("pregnant_unit", IsNullable = true)]
        public string pregnantUnit { get; set; } = "";

        [XmlElement("pregnant", IsNullable = true)]
        public string pregnant { get; set; } = "";

        [XmlArray("allergic_data", IsNullable = true)]
        [XmlArrayItem("allergic", IsNullable = true)]
        public List<AllergicData> allergicData { get; set; } = new List<AllergicData>();

        [XmlArray("diagnose_data", IsNullable = true)]
        [XmlArrayItem("diagnose", IsNullable = true)]
        public List<DiagnoseData> diagnoseDatas { get; set; } = new List<DiagnoseData>();

        [XmlElement("lis_data", IsNullable = true)]
        public string LisData { get; set; } = "";

        [XmlElement("si_data", IsNullable = true)]
        public SIData SiData { get; set; } = new SIData();
    }

    public class AllergicData {
        [XmlElement("type", IsNullable = true)]
        public string type { get; set; } = "";

        [XmlElement("name", IsNullable = true)]
        public string name { get; set; } = "";

        [XmlElement("code", IsNullable = true)]
        public string code { get; set; } = "";
    }

    public class DiagnoseData {
        [XmlElement("type", IsNullable = true)]
        public string type { get; set; } = "";

        [XmlElement("name", IsNullable = true)]
        public string name { get; set; } = "";

        [XmlElement("code", IsNullable = true)]
        public string code { get; set; } = "";
    }

    public class SIData {
        [XmlElement("medical_type", IsNullable = true)]
        public string medicalType { get; set; } = "";

        [XmlElement("person_type", IsNullable = true)]
        public string personType { get; set; } = "";
    }

    public class Prescription {
        [XmlElement("id", IsNullable = true)]
        public string prescriptionId { get; set; } = "";

        [XmlElement("reason", IsNullable = true)]
        public string reason { get; set; } = "";

        [XmlElement("is_circulation", IsNullable = true)]
        public string isCirculation { get; set; } = "";

        [XmlElement("is_urgent", IsNullable = true)]
        public string isUrgent { get; set; } = "";

        [XmlElement("is_new", IsNullable = true)]
        public string isNew { get; set; } = "";

        [XmlElement("is_current", IsNullable = true)]
        public string isCurrent { get; set; } = "";

        [XmlElement("doct_code", IsNullable = true)]
        public string doctorCode { get; set; } = "";

        [XmlElement("doct_name", IsNullable = true)]
        public string doctorName { get; set; } = "";

        [XmlElement("dept_code", IsNullable = true)]
        public string departmentCode { get; set; } = "";

        [XmlElement("dept_name", IsNullable = true)]
        public string departmentName { get; set; } = "";

        [XmlElement("pres_type", IsNullable = true)]
        public string presType { get; set; } = "";

        [XmlElement("pres_time", IsNullable = true)]
        public string presTime { get; set; } = "";

        [XmlArray("medicine_data", IsNullable = true)]
        [XmlArrayItem("medicine", IsNullable = true)]
        public List<Medicine> medicines { get; set; } = new List<Medicine>();
    }

    [XmlRoot("medicine")]
    public class Medicine {
        [XmlElement("pyd_code", IsNullable = true)]
        public string pydCode { get; set; } = "";

        [XmlElement("name", IsNullable = true)]
        public string name { get; set; } = "";

        [XmlElement("his_code", IsNullable = true)]
        public string code { get; set; } = "";

        [XmlElement("insur_code", IsNullable = true)]
        public string insurCode { get; set; } = "";

        [XmlElement("item_type", IsNullable = true)]
        public string itemType { get; set; } = "";

        [XmlElement("insur_type", IsNullable = true)]
        public string insurType { get; set; } = "";

        [XmlElement("spec", IsNullable = true)]
        public string spec { get; set; } = "";

        [XmlElement("group", IsNullable = true)]
        public string group { get; set; } = "";

        [XmlElement("link_group", IsNullable = true)]
        public string linkGroup { get; set; } = "";

        [XmlElement("reason", IsNullable = true)]
        public string reason { get; set; } = "";

        [XmlElement("si_basis", IsNullable = true)]
        public string siBasis { get; set; } = "";

        [XmlElement("dose_unit", IsNullable = true)]
        public string doseUnit { get; set; } = "";

        [XmlElement("dose", IsNullable = true)]
        public string dose { get; set; } = "";

        [XmlElement("freq", IsNullable = true)]
        public string freq { get; set; } = "";

        [XmlElement("administer", IsNullable = true)]
        public string administer { get; set; } = "";

        [XmlElement("begin_time", IsNullable = true)]
        public string beginTime { get; set; } = "";

        [XmlElement("end_time", IsNullable = true)]
        public string endTime { get; set; } = "";

        [XmlElement("days", IsNullable = true)]
        public string days { get; set; } = "";

        [XmlElement("preventiveflag", IsNullable = true)]
        public string preventiveFlag { get; set; } = "";
    }
}
